package homework2;
import java.util.Scanner;
public class Hw2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        boolean flag = false;
        do {
            flag = false;
            System.out.println("请输入会员生日:");
            String birthday = sc.nextLine();
            System.out.println("请输入用户密码:");
            String password = sc.nextLine();

            if (birthday.length() == 5 && birthday.indexOf("/") == 2) {
                if (Integer.parseInt(birthday.substring(0, 2)) >= 1 && Integer.parseInt(birthday.substring(0, 2)) <= 12 && Integer.parseInt(birthday.substring(3, birthday.length())) >= 1 && Integer.parseInt(birthday.substring(3, birthday.length())) <= 31) {
                   flag = true;
                } else {
                    System.out.println("您输入的生日格式不正确");
                    flag = false;
                    continue;
                }

            }else {
                System.out.println("您输入的生日格式不正确");
               continue;
            }

            if (password.length() >= 6 && password.length() <= 10) {
                System.out.println("登陆成功");
                flag = true;
            } else {
                System.out.println("密码长度为6-10位");
                flag = false;
            }

        }while (flag==false) ;
    }
}
